import {router} from './router';
import store from './store';



router.beforeEach((to, from, next) => {
    if(to.path.indexOf("/login") > -1){
      next();
      return;
    }
    // 判断是否登录
    if (isLogin()) {
      next();
    } else {
      // 将跳转的路由存到cookie，登录成功后跳转到该路由
      SetCookie("redirectUrl",window.document.location);
      next({
        path: '/login',
      })
    }
});

